package cn.edu.hznu.coursework.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicUpdate;

@Entity
@Table
@DynamicUpdate(true)
public class Student extends AbstractUser{

	/**
	 * 
	 */
	private static final long serialVersionUID = -3959886578248094694L;

	@Column
	private String className;
	
	@ManyToMany(targetEntity = Course.class, fetch = FetchType.LAZY)
	@JoinTable
	private List<Course> courses;
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "student", orphanRemoval = true)
	private List<StudentWork> works;
 
	public String getClassName() {
		return className;
	}

	public void setClassName(String className) {
		this.className = className;
	}

	public List<Course> getCourses() {
		return courses;
	}

	public void setCourses(List<Course> courses) {
		this.courses = courses;
	}

	public List<StudentWork> getWorks() {
		return works;
	}

	public void setWorks(List<StudentWork> works) {
		this.works = works;
	}
	
}
